import { Column } from "typeorm";

import { VARCHAR50_PG, BIGINT_PG, INTEGER_PG, ExtOrder } from "qqlx-core";

import { TransformerInteger, TransformerBigInteger } from "@lib/orm.transfor.number";
import { TransformerVarchar, TransformerVarchar50 } from "@lib/orm.transfor.string";

import { IntroUUidTradableSchema } from "@/alpha/ext.uuid.tradable-intro";

export class OrderSchema extends IntroUUidTradableSchema implements ExtOrder {
  @Column({ transformer: new TransformerVarchar50() })
  contractSide: VARCHAR50_PG = "";

  @Column({ transformer: new TransformerVarchar50() })
  contractSideOp: VARCHAR50_PG = "";

  @Column({ transformer: new TransformerBigInteger() })
  contractTime: BIGINT_PG = Date.now().toString();

  @Column({ transformer: new TransformerVarchar() })
  contractBrief: VARCHAR50_PG = "";

  @Column({ transformer: new TransformerVarchar50() })
  code: VARCHAR50_PG = "";

  @Column({ transformer: new TransformerInteger(100) })
  amount: INTEGER_PG = 0;

  @Column({ transformer: new TransformerInteger(100) })
  amountTax: INTEGER_PG = 0;
}
